from selenium import webdriver
from selenium.webdriver.chrome.service import Service

class ServiceWeb():
    def __init__(self):
        # 初始化浏览器驱动
        self.service = Service(
            executable_path=r'C:\Users\27211\AppData\Local\Programs\Python\Python39\chromedriver.exe')

    def get_driver(self, web_url):
        """获取浏览器驱动并打开指定URL"""
        driver = webdriver.Chrome(service=self.service)
        driver.get(web_url)
        driver.maximize_window()
        return driver